﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Starfire3d.Interfaces;
using Starfire3d.Data.States;
using Starfire3d.Data.States.UnitStates;
using Starfire3d.Data.Objects;

namespace Starfire3d.Data
{
    public class Ordinance : GameObject, IRenderable
    {
        private StateMachine<Ordinance> stateMachine = null;
        private string target = "";
        private bool impact = false;
        private WeaponSystem weaponType = null;

        public StateMachine<Ordinance> StateMachine
        {
            get { return stateMachine; }
        }

        public bool Impacted
        {
            get { return impact; }
            set { impact = value; }
        }

        public string Target
        {
            get { return target; }
            set { target = value; }
        }

        public WeaponSystem WeaponType
        {
            get { return weaponType; }
            set { weaponType = value; }
        }

        public Ordinance(WeaponSystem weapon)
        {
            CreateDataStore();

            stateMachine = new StateMachine<Ordinance>(this);
            stateMachine.ChangeState(new TrackingOrdinance());

            weaponType = weapon;

            Data.Add("PENAID", 0, true);
        }

        public override bool Update()
        {
            stateMachine.Update();
            return Impacted;
        }

        public override string ToString()
        {
            return Entity_Name + ": " + StateMachine.CurrentState.ToString();
        }
    }
}
